var ns, map, app, timer, marqueesHeight, slide, imageBrowser,
    stopscroll, scrollElem, preTop, currentTop, stoptime, leftElem, popup;
app = new Vue({
    el: '#app',
    data: {
        form: {
            status: 1,//1-进行中 2-已结束
        },
        pageindex: 0,
        pagesize: 10,
        list: [], 
        isviewhistory: false,
        total:0,
        IsHistory: 0,//0 列表 1 历史工单
    },
    methods: {
        get_data: function() {
            var that = this;
            var options = {};
            options.Status = that.form.status;
            options.pageindex = that.pageindex;
            options.pagesize = that.pagesize;
            options.action = "getcheckplanlist";
            ns.post(options, function (succeed, data, err) {
                if (succeed) {
                    that.list = data.data;
                    that.total = data.NoCompleteCount;
                } else if (err) {
                    api.toast({
                        msg: err,
                        duration: 2000,
                        location: 'bottom'
                    });
                }
            }, {
                toast: true
            });
        },
        do_select_tab: function(status) {
            var that = this;
            that.form.status = status;
            that.get_data();
        },
        do_checklist:function(id,IsChangeBt,ProjectID){
            var that=this;
            ns.openWin('quality_checklist_frm', '考核项目',{
                ID:id,
                IsChangeBt:IsChangeBt,
                ProjectID:ProjectID,
            })
        },
        //打开整改工单
        do_openzhengai:function(){
            var that=this;
            ns.openWin('qualitycontrol_mainlist', '整改任务',{
                bg:"#289FFF",
                txtcolor:"#ffffff",
            });
        },
        //检查记录
        do_jiancha:function(){
            var that=this;
            ns.openWin('qualityrenwulist_frm', '检查记录')
        },
        do_open: function(item) {
            var that = this;
            ns.openWin('qualitycontroldetail_frm', '工单详情', {
                id: item.ID,
                isviewhistory: that.isviewhistory
            })
        },

       
    }
});
apiready = function() {
    api.parseTapmode();
    ns = window.Foresight.Util;
    app.isviewhistory = api.pageParam.isviewhistory || false;
    app.get_data();
    api.addEventListener({
        name: 'reloadservicelist'
    }, function(ret, err) {
        app.get_data();
    });

    // api.addEventListener({
    //     name: 'do_open_qualityhistory'
    // }, function (ret, err) {
    //     ns.openWin('qualitycontrollist_history', '历史记录', {
    //         isviewhistory: true,
    //     })
    // });

};
